clear all
set more off
import delimited inventor.csv, encoding(UTF-8) clear 

keep appnum order address name engname
drop if appnum ==.


* 등록여부에 관한 파일 머징 - change the directory where 'basicinfo.dta' exists
merge n:1 appnum using basicinfo, keepusing(regi) keep(3) nogenerate

*cleaning address
gen dist = "경기" if strpos(address, "경기")>0  
replace dist = "강원" if strpos(address, "강원")>0
replace dist = "충북" if strpos(address, "충북")>0 | strpos(address, "충청북")>0 | strpos(address, "충청 북")>0
replace dist = "충남" if strpos(address, "충남")>0 | strpos(address, "충청남")>0 | strpos(address, "충청 남")>0 
replace dist = "전북" if strpos(address, "전북")>0 | strpos(address, "전라북")>0 | strpos(address, "전라 북")>0
replace dist = "전남" if strpos(address, "전남")>0 | strpos(address, "전라남")>0 | strpos(address, "전라 남")>0 
replace dist = "경북" if strpos(address, "경북")>0 | strpos(address, "경상북")>0 | strpos(address, "경상 북")>0 
replace dist = "경남" if strpos(address, "경남")>0 | strpos(address, "경상남")>0 | strpos(address, "경상 남")>0
replace dist = "제주" if strpos(address, "제주")>0
replace dist = "서울" if strpos(address, "서울")>0
replace dist = "대구" if strpos(address, "대구")>0
replace dist = "부산" if strpos(address, "부산")>0
replace dist = "인천" if strpos(address, "인천")>0
replace dist = "광주" if strpos(address, "광주")>0
replace dist = "대전" if strpos(address, "대전")>0
replace dist = "울산" if strpos(address, "울산")>0
replace dist = "세종" if strpos(address, "세종")>0

save invt_loc, replace
